<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<!-- 登录 注册 购物车... -->
<div class="container-fluid">
	<div class="col-md-4">
		<img src="/static/img/logo2.png" />
	</div>
	
	<div class="col-md-3" style="width:500px;padding-top:20px;padding-left: 200px;float: left">
	<c:if test="${not empty currentUser}">
		<ol class="list-inline">
			<%--<a href="<c:url value='/user/get_user_info'/>">--%>
			<li><a href="<c:url value='/user/get_user_info'/>">${currentUser.username }</a></li>
			<li><a href="cart.jsp">我的购物车</a></li>
			<li><a href="orderList">我的订单</a></li>
			<li><a href="<c:url value='/user/logout'/>">退出</a></li>
		</ol>
	</c:if>
	<c:if test="${empty currentUser}">
		<ol class="list-inline">
			<li><a href="<c:url value='/user/login'/>">登录</a></li>
			<li><a href="<c:url value='/user/register'/>" >注册</a></li>
			<li><a href="cart.jsp">购物车</a></li>
			<li><a href="orderList">我的订单</a></li>
		</ol>
	</c:if>
	</div>
</div>

<!-- 导航条 -->
<div class="container-fluid">
	<nav class="navbar navbar-inverse">
		<div class="container-fluid">
			<!-- Brand and toggle get grouped for better mobile display -->
			<div class="navbar-header">
				<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
					<span class="sr-only">Toggle navigation</span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
				</button>
				<a class="navbar-brand" href="<c:url value='/' /> ">首页</a>
			</div>

			<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
				<ul class="nav navbar-nav">
					<li><a href="productlist?cid=1">手机</a></li>
					<li><a href="productlist?cid=2">笔记本</a></li>
					<li><a href="productlist?cid=3">平板电脑</a></li>
				</ul>
				<form class="navbar-form navbar-right" role="search">
					<div class="form-group">
						<input type="text" class="form-control" placeholder="Search">
					</div>
					<button type="submit" class="btn btn-default">搜索</button>
				</form>
			</div>
		</div>
	</nav>
</div>

<script>
	function get_user_info() {
        $.ajax({
            type:"post",
            url:"<c:url value='/user/get_user_info' /> ",
            data:{},
            success:function (data) {
                var result = data.status;
                if(result == 0){
                    location.href="<c:url value='/user/get_user_info' /> ";
                }else if(result == 1){
                    confirmModel(data.msg);
                }
            }
        })
    }

</script>